package com.quantdo.apex.elasticjob.constant;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenkuan
 * @version v1.0
 * @desc ElasticJob配置注入Bean
 * @date 2019/12/11 011 9:54
 */
@Configuration
@ConfigurationProperties(prefix = "elasticjob")
public class JobConfigBean {
	//zookeeper服务地址，多个用,隔开
	private String zookeeperServer;
	//命名空间
	private String namespace;
	//等待重试的间隔时间的初始值,单位毫秒
	private int baseSleepTimeMilliseconds = 1000;
	//等待重试的间隔时间的最大值,单位毫秒
	private int maxSleepTimeMilliseconds = 3000;
	//最大重试次数
	private int maxRetries = 3;
	//会话超时时间,单位毫秒
	private int sessionTimeoutMilliseconds = 60000;
	//连接超时时间,单位毫秒
	private int connectionTimeoutMilliseconds = 15000;

	//本地job实例是否覆盖zookeeper缓存,boolean类型
	private boolean overwrite = true;
	//是否开启任务执行失效转移，开启表示如果作业在一次任务执行中途宕机，允许将该次未完成的任务在另一作业节点上补偿执行
	private boolean failover = false;
	//是否开启错过任务重新执行
	private boolean misfire = true;
	//作业是否禁止启动，可用于部署作业时，先禁止启动，部署结束后统一启动
	private boolean disabled = false;

	public String getZookeeperServer() {
		return zookeeperServer;
	}

	public void setZookeeperServer(String zookeeperServer) {
		this.zookeeperServer = zookeeperServer;
	}

	public String getNamespace() {
		return namespace;
	}

	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}

	public int getBaseSleepTimeMilliseconds() {
		return baseSleepTimeMilliseconds;
	}

	public void setBaseSleepTimeMilliseconds(int baseSleepTimeMilliseconds) {
		this.baseSleepTimeMilliseconds = baseSleepTimeMilliseconds;
	}

	public int getMaxSleepTimeMilliseconds() {
		return maxSleepTimeMilliseconds;
	}

	public void setMaxSleepTimeMilliseconds(int maxSleepTimeMilliseconds) {
		this.maxSleepTimeMilliseconds = maxSleepTimeMilliseconds;
	}

	public int getMaxRetries() {
		return maxRetries;
	}

	public void setMaxRetries(int maxRetries) {
		this.maxRetries = maxRetries;
	}

	public int getSessionTimeoutMilliseconds() {
		return sessionTimeoutMilliseconds;
	}

	public void setSessionTimeoutMilliseconds(int sessionTimeoutMilliseconds) {
		this.sessionTimeoutMilliseconds = sessionTimeoutMilliseconds;
	}

	public int getConnectionTimeoutMilliseconds() {
		return connectionTimeoutMilliseconds;
	}

	public void setConnectionTimeoutMilliseconds(int connectionTimeoutMilliseconds) {
		this.connectionTimeoutMilliseconds = connectionTimeoutMilliseconds;
	}

	public boolean getOverwrite() {
		return overwrite;
	}

	public void setOverwrite(boolean overwrite) {
		this.overwrite = overwrite;
	}

	public boolean getFailover() {
		return failover;
	}

	public void setFailover(boolean failover) {
		this.failover = failover;
	}

	public boolean getMisfire() {
		return misfire;
	}

	public void setMisfire(boolean misfire) {
		this.misfire = misfire;
	}

	public boolean getDisabled() {
		return disabled;
	}

	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}
}
